﻿using System;
using Xunit;

namespace Unity.String.Tests.Number
{
    public class DecimalExtendTest
    {
        [Fact]
        public void MethodsTest()
        {
            decimal testValue = 123.456789m;
            Assert.Equal(123456789u, testValue.Low());
            Assert.Equal(0u, testValue.Middle());
            Assert.Equal(0u, testValue.High());
        }

        [Fact]
        public void IsNegativeTest()
        {
            decimal testPositiveValue = 123.456789m;
            decimal testNegativeValue = -123.456789m;
            Assert.True(testNegativeValue.IsNegative());
            Assert.False(testPositiveValue.IsNegative());
        }

        [Fact]
        public void ScaleTest()
        {
            decimal testValue = 22.11m;
            Assert.Equal(2, testValue.Scale());
        }

        [Fact]
        public void DecDivMod1E9Test()
        {
            decimal testValue = 43.21m;
            Assert.Equal(4321u, DecimalExtend.DecDivMod1E9(ref testValue));
        }
        
    }
}